// models/chat_to_image_model.go
package models

import (
	"gorm.io/gorm"
)

// ChatToImageModel 对话关联图片表
type ChatToImageModel struct {
	Model
	ChatID          uint      `json:"chatID"`
	ChatModel       ChatModel `gorm:"foreignKey:ChatID" json:"-"`
	ImageUrl        string    `gorm:"size:256" json:"imageUrl"`        // 图片路径
	ImageOcrContent string    `gorm:"size:512" json:"imageOcrContent"` // 图片ocr的识别内容
}

func (u *ChatToImageModel) BeforeCreate(tx *gorm.DB) (err error) {
	//out, err := ocr.Ocr(u.ImageUrl)
	//if err != nil {
	//	logrus.Error(err)
	//	return
	//}
	//u.ImageOcrContent = out
	return
}
